// This example shows how to enumerate all event conditions associated with the specified event source. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . using System; using System.Diagnostics; using OpcLabs.EasyOpc.AlarmsAndEvents; using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace; using OpcLabs.EasyOpc.OperationModel; namespace DocExamples.AlarmsAndEvents._EasyAEClient { class QuerySourceConditions { public static void Main1() { // Instantiate the client object. var client = new EasyAEClient(); AEConditionElementCollection conditionElements; try { conditionElements = client.QuerySourceConditions("", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1"); } catch (OpcException opcException) { Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message); return; } foreach (AEConditionElement conditionElement in conditionElements) { Debug.Assert(conditionElement != null); Console.WriteLine("ConditionElements[\"{0}\"]: {1} subcondition(s)", conditionElement.Name, conditionElement.SubconditionNames.Length); } } } }
# This example shows how to enumerate all event conditions associated with the specified event source. # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python . # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc # Import .NET namespaces. from OpcLabs.EasyOpc import * from OpcLabs.EasyOpc.AlarmsAndEvents import * from OpcLabs.EasyOpc.OperationModel import * # Instantiate the client object. client = EasyAEClient() # Perform the operation. try: conditionElements = IEasyAEClientExtension.QuerySourceConditions(client, '', 'OPCLabs.KitEventServer.2', AENodeDescriptor('Simulation.ConditionState1')) except OpcException as opcException: print('*** Failure: ' + opcException.GetBaseException().Message) exit() # Display results. for conditionElement in conditionElements: assert conditionElement is not None print('ConditionElements[', conditionElement.Name, ']: ', conditionElement.SubconditionNames.Length, ' subcondition(s)', sep='') print() print('Finished.')
' This example shows how to enumerate all event conditions associated with the specified event source. ' ' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Imports OpcLabs.EasyOpc.AlarmsAndEvents Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace Imports OpcLabs.EasyOpc.OperationModel Namespace AlarmsAndEvents._EasyAEClient Friend Class QuerySourceConditions Public Shared Sub Main1() Dim client = New EasyAEClient() Dim conditionElements As AEConditionElementCollection Try conditionElements = client.QuerySourceConditions( _ "", "OPCLabs.KitEventServer.2", "Simulation.ConditionState1") Catch opcException As OpcException Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message) Exit Sub End Try For Each conditionElement As AEConditionElement In conditionElements Debug.Assert(conditionElement IsNot Nothing) Console.WriteLine("ConditionElements[""{0}""]: {1} subcondition(s)", _ conditionElement.Name, conditionElement.SubconditionNames.Length) Next conditionElement End Sub End Class End Namespace
Rem This example shows how to enumerate all event conditions associated with the specified event source. Rem Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Option Explicit Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor") ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2" Dim SourceDescriptor: Set SourceDescriptor = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.AENodeDescriptor") SourceDescriptor.QualifiedName = "Simulation.ConditionState1" Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient") On Error Resume Next Dim ConditionElements: Set ConditionElements = Client.QuerySourceConditions(ServerDescriptor, SourceDescriptor) If Err.Number <> 0 Then WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description WScript.Quit End If On Error Goto 0 Dim ConditionElement: For Each ConditionElement In ConditionElements WScript.Echo "ConditionElements(" & ConditionElement.Name & "): " & (UBound(ConditionElement.SubconditionNames) + 1) & " subcondition(s)" Next
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Send Documentation Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.